﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

[Serializable]
public class SaveScript 
{
    public List<ChestData> MyChests { get; set; }
    public List<ActionBarData> MyActionBar { get; set; }
    public List<EquipmentData> MyEquipment { get; set; }
    public PlayerData MyPlayerData { set; get; }
    public InventoryData MyInventoryData { set; get; }
    public DateTime MyDateTime { get; set; }
    public string MyScene { get; set; }
    public SaveScript()
    {
        MyChests = new List<ChestData>();
        MyEquipment = new List<EquipmentData>();
        MyDateTime = DateTime.Now;
        MyInventoryData = new InventoryData();
        MyActionBar = new List<ActionBarData>();
        //MyScene= SceneManager.GetActiveScene().name;
    }
}
[Serializable]
public class PlayerData
{
    public string MyName { get; set; }
    public int MyLevel { get; set; }
    public float MyExp { get; set; }
    public float MyMaxExp { get; set; }
    public float MyHP { get; set; }
    public float MyMaxHP { get; set; }
    public float MySP { get; set; }
    public float MyMaxSP { get; set; }
    public float MyMP { get; set; }
    public float MyMaxMP { get; set; }
    public float MyPosX { get; set; }
    public float MyPosY { get; set; }
    public PlayerData (int level, float exp, float maxExp, float hp, float maxHp, Vector2 pos, string name, float sp, float maxSp, float mp, float maxMp)
    {
        this.MyLevel = level;
        this.MyExp = exp;
        this.MyMaxExp= maxExp;
        this.MyHP= hp;
        this.MyMaxHP= maxHp;
        this.MySP = sp;
        this.MyMaxSP = maxSp;
        this.MyMP = mp;
        this.MyMaxMP = maxMp;
        this.MyPosX= pos.x;
        this.MyPosY= pos.y;
        this.MyName = name;
    }
}

[Serializable]
public class ItemData
{
    public int MyStackCount { get; set; }
    public int MySlotIndex { get; set; }
    public int MyBagIndex { get; set; }
    public string MyItemTitle { get; set; }
    public ItemData(string itemTitle,int stackCount=0, int slotIndex=0, int bagIndex=0)
    {
        MyStackCount = stackCount;
        MySlotIndex = slotIndex;
        MyItemTitle = itemTitle;
        MyBagIndex = bagIndex;
    }
    
}

[Serializable]
public class ChestData
{
    public List<ItemData> MyItems { get; set; }
    public string MyChestTitle { get; set; }
    public ChestData(string chestTitle)
    {
        this.MyChestTitle = chestTitle;
        MyItems = new List<ItemData>();
    }
}

[Serializable]
public class BagData
{
    public int MyBagIndex { get; set; }
    public int MySlotCount { get; set; }
    public BagData(int slotCount, int index)
    {
        this.MyBagIndex = index;
        MySlotCount = slotCount;
    }
}
[Serializable]
public class InventoryData
{
    public List<BagData> MyBags { get; set; }
    public List<ItemData> MyItems { get; set; }
    public InventoryData()
    {
        MyBags = new List<BagData>();
        MyItems = new List<ItemData>();
    }
}

[Serializable]
public class EquipmentData
{
    public string MyTitle{ get; set; }
    public string MyType{ get; set; }
    public EquipmentData(string title, string type)
    {
        MyTitle = title;
        MyType = type;
    }
}
[Serializable]
public class ActionBarData
{
    public string MyAction { get; set; }
    public int MyIndex { get; set; }
    public bool MyIsItem { get; set; }
    public ActionBarData(string action, int index, bool isItem)
    {
        MyAction = action;
        MyIndex = index;
        MyIsItem = isItem;
    }
}